## Adds `~/.local/bin` to $PATH
HOME_BIN=$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')
export PATH="$PATH:$HOME_BIN"

## Default programs:
export EDITOR="nvim"
export TERMINAL="st"
export BROWSER="qutebrowser"
export READER="zathura"

## Prompt
# PURE_PROMPT_SYMBOL=">"
# PURE_PROMPT_VICMD_SYMBOL="<"

## ~/ Clean-up:
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_RUNTIME_DIR="$XDG_CONFIG_HOME"

export ZDOTDIR=$XDG_CONFIG_HOME/zsh

export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch/config"
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
export LESSHISTFILE="-"
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc"
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/inputrc"
#export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
#export PASSWORD_STORE_KEY="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg"
export TMUX_TMPDIR="$XDG_CACHE_DIR"
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat"
export MBSYNCRC="${XDG_CONFIG_HOME:-$HOME/.config}/mbsync/config"
export PENTADACTYL_RUNTIME=$HOME/.config/pentadactyl
export VIKING_MAPS="$XDG_CACHE_HOME/viking"
# export XDG_DATA_DIRS="$XDG_DATA_HOME/viking"
export W3M_DIR="$HOME/.config/w3m"

## Other program settings:
export FZF_DEFAULT_OPTS="--layout=reverse --height 50%"
## set options for less
export LESS='--quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --no-init --window=-4'
## or the short version
# export LESS='-F -i -J -M -R -W -x4 -X -z-4'
## Set colors for less. Borrowed from https://wiki.archlinux.org/index.php/Color_output_in_console#less .
export LESS_TERMCAP_mb=$'\E[1;31m'     # begin bold
export LESS_TERMCAP_md=$'\E[1;36m'     # begin blink
export LESS_TERMCAP_me=$'\E[0m'        # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m'        # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m'     # begin underline
export LESS_TERMCAP_ue=$'\E[0m'        # reset underline
# export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export LESSOPEN='|lesspipe.sh %s'
export QT_QPA_PLATFORMTHEME="gtk2"	# Have QT use gtk2 theme.
export MOZ_USE_XINPUT2="1"		# Mozilla smooth scrolling/touchpads.
export _JAVA_AWT_WM_NONREPARENTING=1	# Fix for Java applications in dwm

## fzf: search also hidden files
export FZF_DEFAULT_COMMAND='fd --type f -H'

## Option for nnn file manager
#export VISUAL=ewrap
export NNN_BMS='l:~/.local;c:~/.config;d:~/Documents;m:~/Music;v:~/Video;D:~/Downloads/'
export NNN_FIFO='/tmp/nnn.fifo'
export NNN_PLUG='f:fzopen;p:preview-tui;d:diffs;t:nmount;v:imgview;c:fzcd'
export NNN_TRASH=1
export NNN_FCOLORS='c1e2272e006033f7c6d6abc4'
export NNN_ARCHIVE="\\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)"
# export NNN_OPENER=~/.config/nnn/plugins/nuke

## man option for vim`
export MANPAGER='nvim +Man!'

## Clipmenu options
## $CM_DIR: specify the base directory to store the cache dir in (default: $XDG_RUNTIME_DIR, $TMPDIR, or /tmp)
## $CM_HISTLENGTH: specify the number of lines to show in dmenu/rofi (default: 8)
## $CM_LAUNCHER: specify a dmenu-compatible launcher (default: dmenu)
## $CM_OUTPUT_CLIP: if set, output clip selection to stdout
# export CM_LAUNCHER=fzf
# export CM_OUTPUT_CLIP=1
export CM_HISTLENGTH=16

## Start graphical server on tty1 if not already running.
# [ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx
[ "$(tty)" = "/dev/tty1" ] && slstatus -s | dwl
#if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx; fi # Profile file. Runs on login. Environmental variables are set here.
